package com.fy.pojo.enums;

import lombok.Getter;

/**
 * 聊天消息类型枚举
 */
@Getter
public enum MessageTypeEnum {
    
    USER_MESSAGE(0, "用户消息"),
    SYSTEM_MESSAGE(1, "系统消息"),
    AI_REPLY(2, "AI回复"),
    HUMAN_REPLY(3, "人工回复");
    
    /**
     * 类型值
     */
    private final Integer value;
    
    /**
     * 类型描述
     */
    private final String text;
    
    MessageTypeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }
    
    /**
     * 根据 value 获取枚举值
     */
    public static MessageTypeEnum getEnumByValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (MessageTypeEnum anEnum : MessageTypeEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}